<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<title>查询配送企业列表</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content">
        <div class="box box-success">
            <div class="box-body">
                <div class="form-inline">
                     <div class="form-group form-group-xs">
                        <label for="txtDrugForm">配送企业名称：</label>
                        <input class="form-control" type="text" id="compName" placeholder="配送企业名称" />
                    </div>
					<div class="form-group form-group-xs">
                        <label for="txtDrugForm">配送企业编码：</label>
                        <input class="form-control" type="text" id="compCode" placeholder="配送企业编码" />
                    </div>
                    <button type="button" onclick="likeQuery();" class="btn btn-success btn-sm">查询</button>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
		 <div class="box box-warning bottongroup">
            <button type="button" class="btn btn-primary btn-sm" onclick="batchGroupAddComp()">选择</button>
            <button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">取消</button>
         </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
        $(function () {

            $("#gridlist").jqGrid({
                url: "getBidDataList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                height: 160,
                colNames: ['企业编码', '企业名称', '组织机构代码', '所属集团', '注册地', '机构电话', 'hideCompName'],
                colModel: [
                    { name: 'compCode', width: 140,align:"center" },
                    { name: 'compName', width: 190,align:"left",
						 formatter:function(val, opts,rowdata) {
							 return compInfoLink(rowdata.compCode, val, 1);
                         }
                    },
                    { name: 'orgCode', width: 120,align:"center" },
                    { name: 'groupName', width: 120,align:"center"},
                    { name: 'areaName',width: 80,align:"center" },
                    { name: 'compPhone',width: 80,align:"center"},
                    { name: 'hideCompName',width: 80,align:"center", hidden:true,
                        formatter:function(val, opts,rowdata) {
                            return rowdata.compName;
                        }
                    }
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "配送企业列表",
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        
     	function likeQuery() {
			var projId = $("#sprojId").val();
			var compName = $("#compName").val();
			var compCode = $("#compCode").val();
			$("#gridlist").jqGrid('setGridParam',{
       	    	datatype:'json',
                postData:{
                	"projId":projId,
                	"compName":compName,
					"compCode":compCode
                },
                page : 1
			}).trigger("reloadGrid");
		}
    	
        function batchGroupAddComp(){
        	var rowid = $("#gridlist").jqGrid('getGridParam', 'selrow');
        	if (rowid == null || rowid == ""){
        		$.HN.message.alert("请选择配送企业！", "消息", "warn");
        		return;
        	}
			var rowdata = $("#gridlist").jqGrid('getRowData', rowid);
			var dialog = top.dialog.get(window);
			dialog.close({
				"compCode" : rowdata.compCode, 
				"compName" : rowdata.hideCompName
			}); // 关闭（隐藏）对话框
			// dialog.remove(); // 主动销毁对话框
 			return false;
        }
    </script>
</body>
</html>